<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views/common/common-taglib.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
<%@ include file="/WEB-INF/views/common/common-meta.jsp"%>
<title>任务详情-教学材料管理系统</title>
<%@ include file="/WEB-INF/views/common/common-css.jsp"%>
</head>
<body>
	<!-- header -->
	<%@ include file="/WEB-INF/views/common/header.jsp"%>

	<!-- 主管理区域 admin-main -->
	<div class="am-cf admin-main higher">
		<!-- 侧边栏 side bar start -->
		<div class="admin-sidebar">
			<%@ include file="/WEB-INF/views/sidebar/sidebar.jsp"%>
		</div>
		<!-- side bar end -->

		<!-- 内容区域 content start -->
		<div class="admin-content" id="admin-content">
			<div class="am-cf am-padding">
				<div class="am-fl am-cf">
					<strong class="am-text-primary am-text-lg">教学任务管理</strong> / <small><a
						href="task.action">教学任务</a></small> / <small>任务详情</small>
				</div>
			</div>
			<div class="am-tabs am-margin">
				<ul class="am-tabs-nav am-nav am-nav-tabs">
					<li class="am-active"><a href="javascript:;">教学任务信息</a></li>
				</ul>

				<div class="am-tabs-bd">
					<div class="am-tab-panel am-fade am-in am-active" id="job-tag">
						<form class="am-form" id="taskForm"
							action="task/updateTaskSubmit.action" method="post">
							<div class="am-u-sm-1 am-text-left">
								<strong>教学任务</strong>
							</div>
							<br>
							<hr>
							<div class="am-g am-margin-top">
								<div class="am-u-sm-2 am-text-right">年份</div>
								<div class="am-u-sm-4 am-text-left">${task.taskYear}</div>
								<div class="am-u-sm-6 am-text-right"></div>
							</div>

							<div class="am-g am-margin-top">
								<div class="am-u-sm-2 am-text-right">学期</div>
								<div class="am-u-sm-4 am-text-left">
									<t:dictdata dictdata="${task.taskTerm}" dict="term" />
								</div>
								<div class="am-u-sm-6 am-text-right"></div>
							</div>

							<div class="am-g am-margin-top">
								<div class="am-u-sm-2 am-text-right">班级</div>
								<div class="am-u-sm-4 am-text-left">${task.className}</div>
								<div class="am-u-sm-6 am-text-right"></div>
							</div>

							<div class="am-g am-margin-top">
								<div class="am-u-sm-2 am-text-right">课程名称</div>
								<div class="am-u-sm-4 am-text-left">${task.courseName}</div>
								<div class="am-u-sm-6 am-text-right"></div>
							</div>

							<div class="am-g am-margin-top">
								<div class="am-u-sm-2 am-text-right">课时安排</div>
								<div class="am-u-sm-6 am-text-left">
									<c:forEach items="${weeks}" var="week">
									${week}周
									</c:forEach>
								</div>
								<div class="am-u-sm-4 am-text-left"></div>
							</div>

							<div class="am-g am-margin-top">
								<div class="am-u-sm-2 am-text-right">任务备注</div>
								<div class="am-u-sm-4">${task.remark}</div>
								<div class="am-u-sm-4"></div>
							</div>

							<input type="hidden" value="${task.taskId}" name="taskId">
							<br>

						</form>

						<div class="am-u-sm-1 am-text-left">
							<strong>任课老师</strong>
						</div>
						<br>
						<hr>
						<div class="am-g am-margin-top">
							<div class="am-u-sm-2 am-text-right">任课老师</div>
							<div class="am-u-sm-6 am-text-left">
								<div id="teacher-selected">
									<t:pril action="/task/selectTeacher">
										<c:if test="${teacher==null}">
											<button type="button" class="am-btn am-btn-primary am-btn-xs"
												onclick="selectTeacher()">
												<span class="am-icon-pencil-square-o"></span> 选择教师
											</button>
										</c:if>
										<c:if test="${teacher!=null}">
									${teacher.teacherName}&nbsp;&nbsp;&nbsp;&nbsp;
									<button type="button" class="am-btn am-btn-primary am-btn-xs"
												onclick="selectTeacher()">
												<span class="am-icon-pencil-square-o"></span> 重新选择
											</button>
										</c:if>
									</t:pril>
								</div>
								<form action="task/selectTeacher.action" method="post"
									id="teacher-select" hidden="true">
									<table
										class="am-table am-table-striped am-table-hover table-main">
										<thead>
											<tr>
												<th class="table-check"></th>
												<th class="table-type">姓名</th>
												<th class="table-type">性别</th>
												<th class="table-type">电话</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach items="${teachers}" var="t">
												<tr>
													<td><input type="radio" name="teacherId"
														value="${t.teacherId}"
														<c:if test="${t.teacherId==teacher.teacherId}">checked="checked"</c:if> /></td>
													<td>${t.teacherName}</td>
													<td>${t.teacherSex}</td>
													<td>${t.teacherPhone}</td>
												</tr>
											</c:forEach>
										</tbody>
									</table>
									<input type="hidden" name="taskId" value="${task.taskId}">
									<div class="am-u-sm-12 am-text-left">
										<button type="submit" class="am-btn am-btn-primary am-btn-xs">
											<span class="am-icon-pencil-square-o"></span> 确认
										</button>
										<button type="button" class="am-btn am-btn-primary am-btn-xs"
											onclick="cancelSelectTeacher()">
											<span class="am-icon-pencil-square-o"></span> 取消
										</button>
										<button type="button"
											onclick="javascript:$.AMUI.progress.start();location.href='teacher/addTeacher.action';"
											class="am-btn am-btn-default am-btn-xs am-text-secondary">
											<span class="am-icon-pencil-square-o"></span> 添加教师
										</button>
									</div>
								</form>
							</div>
							<div class="am-u-sm-4 am-text-left"></div>
						</div>

						<div class="am-u-sm-1 am-text-left">
							<strong>材料归档</strong>
						</div>
						<br>
						<hr>
						<c:forEach items="${meteList}" var="mete">
							<div class="am-g am-margin-top">
								<div class="am-u-sm-2 am-text-right">${mete.meteName}</div>
								<div class="am-u-sm-2 am-text-left">
									<c:if test="${mete.modelPath != '' && mete.modelPath != null}">
										<a
											href="downloadFile.action?name='${mete.meteName}'&fileName=${mete.modelPath}">模板下载</a>&nbsp;
									</c:if>
									<c:if test="${mete.modelPath == '' || mete.modelPath == null}">
										模板未上传
									</c:if>
								</div>
								<div class="am-u-sm-4 am-text-left"
									id="meteFileDiv${mete.meteId}">
									<c:if test="${mete.metePath != '' && mete.metePath != null}">
										<a
											href="downloadFile.action?name='${mete.meteName}'&fileName=${mete.metePath}">材料已上传</a>&nbsp;
											<t:pril action="/task/uploadMete">
											<button type="button" class="am-btn am-btn-primary am-btn-xs"
												onclick="uploadMete(${mete.meteId})" id="subBtn">重新上传</button>
										</t:pril>
									</c:if>
									<c:if test="${mete.metePath == '' || mete.metePath == null}">
										材料未上传&nbsp;&nbsp;
										<t:pril action="/task/uploadMete">
											<button type="button" class="am-btn am-btn-primary am-btn-xs"
												onclick="uploadMete(${mete.meteId})" id="subBtn">点击上传</button>
										</t:pril>
									</c:if>
								</div>

								<form action="task/uploadMete.action" method="post"
									enctype="multipart/form-data" id="uploadMeteDiv${mete.meteId}"
									hidden="true">
									<div class="am-u-sm-4 am-text-right">
										<input class="file" type="file" multiple
											data-max-file-count="1" id="meteFile" name="meteFile"
											accept=".doc,.docx,.xls,.xlsx,rar"> <input
											type="hidden" name="meteId" value="${mete.meteId}"> <input
											type="hidden" name="taskId" value="${task.taskId}">
									</div>
									<div class="am-u-sm-4 am-text-left">
										<t:pril action="/task/uploadMete">
											<button type="submit" class="am-btn am-btn-primary am-btn-xs">点击上传</button>
										</t:pril>
										<button type="button"
											onclick="cancleUploadMete(${mete.meteId})"
											class="am-btn am-btn-primary am-btn-xs">取消上传</button>
									</div>
								</form>
							</div>
							<hr>
						</c:forEach>
					</div>
				</div>
			</div>

		</div>
		<!-- content end -->
	</div>

	<!-- footer -->
	<%@ include file="/WEB-INF/views/common/footer.jsp"%>
	<!-- 控制js -->
	<%@ include file="/WEB-INF/views/common/common-js.jsp"%>

	<script src="assets/script/task/task-detail.js"></script>
</body>
</html>

